<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>切割</title>
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}
			
			.container {
				width: 100vw;
				height: 100vh;
				display: flex;
				align-items: center;
				justify-content: center;
			}
			
			canvas {
				width: 500px;
				height: 500px;
				border: 2px solid blue;
			}
		</style>
	</head>

	<body>
		<div class="container">
			<canvas id="canvas" width="500" height="500"></canvas>
		</div>
	</body>
	<script type="text/javascript">
		window.onload = function() {
			let oCanvas = document.getElementById('canvas');
			console.dir(oCanvas);
			let oPen = oCanvas.getContext("2d");
			
			let oImage = new Image();
			oImage.src = "cut.jpeg";
			oImage.onload = function() {
				//oPen.drawImage(oImage, 82, 123,336,254);
	//被截取时在源图片中的横坐标，被截取图片的纵坐标，被截取图片的宽度，被截取图片的高度，  （截取完放置的位置）x y（均为左上角坐标）,w h
	        oPen.drawImage(oImage,0,200,70,140,10,10,70,140);
	        oPen.drawImage(oImage,70,160,50,120,90,10,50,120);
			}

		}
	</script>
	</body>

</html>